package com.fh.controller.system.web3jTest;

import java.math.BigInteger;

import org.web3j.crypto.Credentials;
import org.web3j.crypto.WalletUtils;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.http.HttpService;
import org.web3j.tx.Contract;

public class SmartContractTest1 {
	   public static final BigInteger GAS_LIMIT = BigInteger.valueOf(180_000_000);
	   public static final BigInteger GAS_PRICE = BigInteger.valueOf(22_000_000_000L);

	public static void main(String[] args) throws Exception {
	         Web3j web3j = Web3j.build(new HttpService("http://192.168.1.3:8545"));
	         Credentials credentials = WalletUtils.loadCredentials("123456", "D://UTC--2018-08-31T09-01-32.162000000Z--86d92bf27a82b84571494d9c7d3361b6f3c66bc3.json");
	        System.out.println("sss");
	         //部署智能合约
	         Greeter greeter = Greeter.deploy(web3j,credentials,Contract.GAS_PRICE,Contract.GAS_LIMIT,"YTC").send();
	        System.out.println(greeter.getContractAddress());
	         System.out.println(greeter.greet().send());
	 
	     }
}
